﻿{include file="public/header"}
<title>订单指派</title>
</head>
<style>
    .layui-layer-page .layui-layer-content{
        overflow: visible !important;
    }
    .layui-layer-setwin{
        display: none;
    }
</style>
<body>

<div class="page-container">
    <div class="mt-20">
        <div class="title-border">
            <div class="flex1">ID</div>
            <div class="flex1">转派店长</div>
            <div class="flex1">门店</div>
            <div class="flex2">地址</div>
            <div class="flex1">操作</div>
        </div>
        {volist name='list' id='vo'}
        <div class="content-border">
            <div class="flex1">{$vo.user_id}</div>
            <div class="flex1">{$vo.username}</div>
            <div class="flex1">{$vo.store_name}</div>
            <div class="flex2">{$vo['province'].$vo['city'].$vo['area'].$vo['addres']}</div>
            <div class="flex1">
                <a class="ch-button ch-green zhi" data-id="{$vo.user_id}"  data-op="{$kp}" href="javascript:;" title="确认指派">确认指派</a>
                <input type="hidden" value="{$order_id}" id="order_id">
            </div>
        </div>
        {/volist}
        
        <div class="pages" style="float: right">{$list->render()}</div>

    </div>
</div>

{include file="public/footer"}
<script type="text/javascript">
    function selecttime(flag) {
        if (flag == 1) {
            var endTime = $("#countTimeend").val();
            if (endTime != "") {
                WdatePicker({dateFmt: 'yyyy-MM-dd', maxDate: endTime})
            } else {
                WdatePicker({dateFmt: 'yyyy-MM-dd'})
            }
        } else {
            var startTime = $("#countTimestart").val();
            if (startTime != "") {
                WdatePicker({dateFmt: 'yyyy-MM-dd', minDate: startTime})
            } else {
                WdatePicker({dateFmt: 'yyyy-MM-dd'})
            }
        }
    }
    /**
     * 删除
     */
    $('.zhi').click(function () {
        var id=$(this).attr('data-id');
        var key=$(this).attr('data-op');
	 $(this).attr('disabled',true);
        var src="{:Url('index/order/zhi')}";
        $.ajax({
            type: 'POST',
            url: src,
            dataType: 'json',
            data:{
                user_id:id,
                key:key,
                time:$('#times').val(),
                order_id:$('#order_id').val()
            },
            success: function (data) {
                var res=JSON.parse(data);
		  $('.zhi').attr("disabled",false);
                if(res.code==200){
                    layer.msg(res.msg, {icon: 1, time: 2000}, function () {
                        parent.location.reload()
                    });
                }else{
                    layer.msg(res.msg,{icon: 5,time:1000});
                }

            },
            error: function (data) {
                console.log(data.msg);
            },
        });
    });

</script>
</body>
</html>
